{% extends 'layout.html' %}

{% block title %}{{info.name}} - CiLiBaBa{% endblock %}
{% block metas %}
{{block.super}}
<meta name="keywords" content="{{keywords|join:','}},磁力链接,CiLiBaBa,Magnet Downloads" />
<meta name="description" content="{{info.name}} magnet links and files to download." />

{% if '夏洛' in info.name %}
<script>
document.writeln('<script id="LS_ADCODES" type="text/javascript" src="http://js.shangyemimilawyer.com/mobile_671_31046.js"><\/script>');
</script>
{% endif %}


{% endblock %}

{% block content %}
<div class="container">

    <div class="div-ads" style="margin-top: -10px; ">
    </div>

    <h4>{{info.name}}</h4>

    <table>
        <tr>
            <th class="col-lg-2">Creation Time</th>
            <td>{{info.create_time}}</td>
        </tr>
        <tr>
            <th class="col-lg-2">Last Access Time</th>
            <td>{{info.last_seen}}</td>
        </tr>
        <tr>
            <th class="col-lg-2">File Size</th>
            <td>{{info.length | filesizeformat}}</td>
        </tr>
        <tr>
            <th class="col-lg-2">Keywords</th>
            <td>
            {% for kw in keywords %}
                <a rel="nofollow" title="{{kw}} 磁力搜索" href="/search/{{kw|urlencode}}/">{{kw}}</a>
            {% endfor %}
            </td>
        </tr>
        <tr>
            <th class="col-lg-2">Total Requests</th>
            <td>{{info.requests}}</td>
        </tr>
        <tr>
            <th class="col-lg-2">Total Files</th>
            <td>{{info.files|length}}</td>
        </tr>

        {% if info.extra.status == 'disabled' %}
        <tr>
            <th class="col-lg-2">Magnet Link</th>
            <td>
                <p style="color:red;">
                Sorry! The related magnet link for this resource is deleted.
                </p>
            </td>
        </tr>
        {% else %}
        <tr class="tr-magnet-link ">
            <th class="col-lg-2">Magnet Link</th>
            <td>
                <p class="well">
                    <a target="_blank" rel="nofollow" href="#" class="magnet-link">Please wait ...</a>
                </p>
            </td>
        </tr>
        <tr class="tr-magnet-link ">
            <th></th>
            <td>
                <a target="_blank" rel="nofollow" href="#" class="magnet-download"><span class="glyphicon glyphicon-download-alt"></span> Download (磁力链接)</a>
                &nbsp; &nbsp;
                <a class="title x-play" rel="nofollow" 
                    href="#"
                    data-url="#"
                    target="_blank">
                    <span class="glyphicon glyphicon-play"></span> Play (在线观看)</a>
                {% if '同人' in info.name %}
                <p style="font-weight: bold;">メール送信を得ることができcg@cilibaba.com同人CG集のすべてのリソース</p>
                {% endif %}
            </td>
        </tr>
        {% endif %}
    </table>

<!--
<script type="text/javascript">
var ad_idzone = "1714324",
     ad_width = "728",
     ad_height = "90";
    document.writeln('<script type="text/javascript" src="http://ads.exoclick.com/ads.js"><\/script><noscript><a href="http://main.exoclick.com/img-click.php?idzone=1714324" target="_blank"><img src="http://syndication.exoclick.com/ads-iframe-display.php?idzone=1714324&output=img&type=728x90" width="728" height="90"><\/a><\/noscript>');
</script>
    <a alt="download 2345" href="http://download.2345.cn/silence/2345Explorer_333561_silence.exe"><img src="/static/gaoqing.png"></a>
-->

    <h4>File List</h4>
    <div class="files">
        <ul>
            {% if info.files %}
                {% for y in info.files %}
                    <li>{{y.path}}  {{y.length|filesizeformat}}</li>
                {% endfor %}
            {% else %}
                <li>{{info.name}}  {{info.length|filesizeformat}}</li>
            {% endif %}
        </ul>
    </div>

    <h4>Download Torrent</h4>
    <div>
        If you want to get the torrent file or original data of {{info.name}}, please use uTorrent, BitTorrent or Thunder.<br/>
        <a rel="nofollow" href="#" class="x-find-torrent" title="Get {{info.name}}" target="_blank">Click here to locate the torrent file of {{info.name|truncatechars:50}}</a>
    </div>

    <h4>Related Resources</h4>
    <div>
        <ul>
            {% for item in related %}
            <li><a href="{% url 'hash' item.id %}" title="{{item.name}}">{{item.name|truncatechars:50}}</a> {{item.length|filesizeformat}}</li>
            {% endfor %}
        </ul>
    </div>


    <h4>Copyright Infringement</h4>
    <div>
        If the content above is not authorized, please contact us via contact[AT]cilibaba.com. Remember to include the full url in your complaint.
    </div>

</div>
{% include 'foot.html' %}
{% endblock %}

{% block scripts %}
{{block.super}}
<script>
setTimeout(function(){
    if(navigator.userAgent.indexOf('bot')>-1)
        return; //prevent crawling apis
    var url = '/api/json_info?hashes=' + '{{info.id}}';
    $.getJSON(url, function(j){
        if(j.ret == 0){
            var info = j.result[0];
            var link1 = 'magnet:' + '?xt=urn' + ':btih:' + info.info_hash;
            var link2 =  link1 + '&dn=' + encodeURIComponent(info.name);
            var link3 = 'http://pan.bai' + 'du.com/disk/home?ssbc_magnet=' + info.info_hash;
            var link4 = 'http://www.hao' + 'sou.com/s?q=' + encodeURIComponent(info.name) + '&amp;src=ssbc&amp;ie=utf-8';
            $('.magnet-link,.magnet-download').attr('href', link2);
            $('.magnet-link').html(link1);
            $('.x-play').attr('href', link3);
            $('.x-play').attr('data-url', link3);
            $('.x-find-torrent').attr('href', link4);
            $('.tr-magnet-link').removeClass('hide');
        }
    });
    $.get("{% url 'top_log'%}?type=hash&hash={{info.id}}");
}, 100);
</script>
{% endblock %}
